package com.ewanghuiju.app.ui.my.adapter;

import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewanghuiju.app.R;
import com.ewanghuiju.app.model.bean.response.AddressListResponBean;

/**
 * @author sj  qq:751943509
 * @class 地址列表 adapter
 * @time 2020/2/20
 */
public class AddressListAdapter extends BaseQuickAdapter<AddressListResponBean, BaseViewHolder> {

    public AddressListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    protected void convert(BaseViewHolder helper, AddressListResponBean item) {
        helper.setText(R.id.tv_nickname, TextUtils.isEmpty(item.getName()) ? "" : item.getName());
        helper.setText(R.id.tv_phone_no, TextUtils.isEmpty(item.getMobile()) ? "" : item.getMobile());
        helper.setText(R.id.tv_address_details, "地址："+item.getProvince() + item.getCity() + item.getCountry() + item.getDetail());
        if (item.getIs_default() == 1) {
            helper.setVisible(R.id.tv_default, true);
        } else {
            helper.setVisible(R.id.tv_default, false);
        }

    }
}
